package com.jorado.metrics.util;

public final class EnvUtils {

    private static boolean localEnv = detectEnv();

    private static boolean useV4 = detectIsUseV4();

    private static boolean isReportFetal = detectReportFetal();

    public static boolean isReportFetal() {
        return isReportFetal;
    }

    private static boolean detectReportFetal() {
        String runEnv = System.getProperty("reportFetal", "1");
        if ("1".equals(runEnv)) {
            return true;
        }
        return false;
    }

    public static boolean isUseV4() {
        return useV4;
    }

    private static boolean detectIsUseV4() {
        String runEnv = System.getProperty("use_v4", "0");
        if ("1".equals(runEnv)) {
            return true;
        }
        return false;
    }

    public static boolean islocalEnv() {
        return localEnv;
    }

    public static boolean detectEnv() {
        String os = System.getProperty("os.name");
        if (os.toLowerCase().startsWith("win")) {
            return true;
        } else if (os.toLowerCase().startsWith("mac")) {
            return true;
        }
        return false;
    }

    public static boolean isRegZk() {
        String runEnv = System.getProperty("reg_zk", "on");
        if ("off".equals(runEnv)) {
            return false;
        }
        return true;
    }

}
